<template>
  <div class="child">
    <h2>这是后代组件</h2>
    <h2>{{ p }}</h2>
  </div>
</template>

<script>
import {inject} from "vue";

export default {
  name: "Child",
  setup() {
    let p = inject('persons');
    return {
      p
    }
  }
}
</script>

<style scoped>
.child {
  background-color: grey;
}
</style>